package duoxiancheng;

/**
 * 守护线程：是为用户线程服务的；jvm停止不用等待守护线程执行完毕
 * 默认：用户线程jvm等待用户执行完毕才会停止，否则不会停
 */
public class shouhuxiancheng {
    public static void main(String[] args) {
        Your y = new Your();
        God g = new God();
        Thread t = new Thread(g);
        t.setDaemon(true);//将用户线程调整为守护
        t.start();
        new Thread(y).start();

    }
}

class Your implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i <=365*100 ; i++) {
            System.out.println("happy life");
        }
        System.out.println("0000000000000");
    }
}

class God implements Runnable{
    @Override
    public void run() {
        while (true) {
            System.out.println("bless you");
        }
    }
}

